#pragma once

#include "button.h"
#include "imageclipstrip.h"

class TextButton : public Button
{
protected:
	/** what to draw in this button (if anything) */
	ImageClipStrip m_textGraphics;
public:
	void copy(const TextButton & b)
	{
		Button::copy(b);
		m_textGraphics.copy(b.m_textGraphics);
	}
	TextButton():Button(){}
	void setArea(const SRect &a_area)
	{
		Button::setArea(a_area);
	}
	void setText(const char * a_text)
	{
		m_textGraphics.createStringStrip(a_text);
		SRect * area = getArea();
		if(area->getDimension().isZero())
		{
			SRect contentArea(SPoint(0,0), m_textGraphics.getDimension());
			setArea(contentArea);
		}
	}
	TextButton(const char * a_text):Button()
	{setText(a_text);}
	void draw(SDL_Surface * a_screen)
	{
		SRect area(*getArea());
		VSDL_FillRect(a_screen, &area, getMasterPanel()->getColor(isOn()
			?MasterPanel::COLOR_ACTIVE
			:MasterPanel::COLOR_BG));
		m_textGraphics.draw(a_screen, getArea()->getPosition());
	}
};